{% extends "layout.html" %}

{% block css_m %}
    <link type="text/css" rel="stylesheet"
          href="/static/plugins/bootstrap-3.3.7-dist/css/bootstrap-datetimepicker.min.css">
    <style>
        .test_content {
            margin-top: 3px;
        }
        .sym_content {
            margin-top: 3px;
        }
    </style>
{% endblock %}
{% block js_m %}
    <script type="text/javascript"
            src="/static/plugins/bootstrap-3.3.7-dist/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript"
            src="/static/plugins/bootstrap-3.3.7-dist/js/bootstrap-datetimepicker.zh-CN.js"></script>
{% endblock %}

{% block content_body %}
    <div class="page-jumbotron center-block" style="width: 800px">
        <h1>添加就诊信息</h1>
    </div>
    <div class="panel-body center-block" style="width: 800px">
        <form method="post" novalidate>
            {% csrf_token %}
            {% for field in form_add %}
                {% if field.label == '检查治疗项目' %}
                    <div class="form-group">
                        <label>{{ field.label }}</label>
                        {{ field }}
                        <a class="test_content btn btn-primary">鼻道镜检查</a>
                        <a class="test_content btn btn-danger">排毒膏</a>
                        <a class="test_content btn btn-warning">修复膏</a>
                        <a class="test_content btn btn-success">巩固膏</a>
                        <a class="test_content btn btn-default">熏蒸</a>
                        <a class="test_content btn btn-default">鼻窦按摩</a>
                        <a class="test_content btn btn-default">鼻腔清洗</a>
                        <a class="btn btn-link" id="test_clean">清除输入</a>
                        <span class="error_msg">{{ field.errors.0 }}</span>

                    </div>
                {% elif field.label == '本次症状' %}
                    <div class="form-group">
                        <label>{{ field.label }}</label>
                        {{ field }}
                        <a class="sym_content btn btn-primary">鼻塞</a>
                        <a class="sym_content btn btn-warning">喷嚏</a>
                        <a class="sym_content btn btn-warning">流涕</a>
                        <a class="sym_content btn btn-warning">头痛</a>
                        <a class="sym_content btn btn-default">头晕</a>
                        <a class="sym_content btn btn-default">失眠</a>
                        <a class="sym_content btn btn-default">夜醒</a>
                        <a class="sym_content btn btn-default">打鼾</a>
                        <a class="sym_content btn btn-default">呼吸费力</a>
                        <a class="sym_content btn btn-default">胸闷气短</a>
                        <a class="sym_content btn btn-default">记忆力减退</a>

                        <a class="btn btn-link" id="sym_clean">清除输入</a>
                        <span class="error_msg">{{ field.errors.0 }}</span>

                    </div>
                    {% elif field.label in '客户id 试用/已购买' %}
                    <div class="hidden">
                        <label>{{ field.label }}</label>
                        {{ field }}
                        
                        

                    </div>

                {% else %}
                    <div class="form-group">
                        <label>{{ field.label }}</label>
                        {{ field }}
                        <span class="error_msg">{{ field.errors.0 }}</span>
                    </div>
                {% endif %}
            {% endfor %}

            <button type="submit" class="btn btn-primary">提交</button>
            <a class="btn btn-default" href="/customer/{{ pid }}/details.html/">取 消</a>
        </form>

    </div>








{% endblock %}

{% block content_bottom %}
    <script>
        $(function () {

            $('#id_test_date').datetimepicker({


                format: 'yyyy-mm-dd hh:ii',
                language: 'zh-CN',
                autoclose: true,
                todayBtn: "linked",
                todayHighlight: true
            });
            $(".test_content").on("click", function () {
                if ($('#id_test_treatment').val().indexOf($(this).text()) === -1) {
                    if ($('#id_test_treatment').val()) {
                        $('#id_test_treatment').val($('#id_test_treatment').val() + " " + $(this).text())
                    } else {
                        $('#id_test_treatment').val($('#id_test_treatment').val() + $(this).text())
                    }
                }
            });
            $("#test_clean").on("click", function () {

                $('#id_test_treatment').val("")
            });
            $(".sym_content").on("click", function () {
                if ($('#id_symptom').val().indexOf($(this).text()) === -1) {
                    if ($('#id_symptom').val()) {
                        $('#id_symptom').val($('#id_symptom').val() + " " + $(this).text())
                    } else {
                        $('#id_symptom').val($('#id_symptom').val() + $(this).text())
                    }
                }
            });
            $("#sym_clean").on("click", function () {

                $('#id_symptom').val("")
            });
        })
    </script>
{% endblock %}